/**
 * create by young (young2f@outlook.com) on 2023/4/22
 */
'use strict';
import moment from 'moment';
import {Button, Form, Input, notification, Select} from 'antd';
import ComponentBase from '../../components/Base/ComponentBase';
import {FormField, FormLayout, ModalFooter} from 'antd-extra';
import notify from '../../components/NotificationExtra';
import React from 'react';
import {connect} from 'dva';
import ReactJson from 'react-json-view';

const {TextArea} = Input;

moment.locale('zh-cn');
@Form.create()
@connect(({global, user, device}) => ({...global, ...user, ...device}))
export default class ModalJsonInfo extends ComponentBase {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {

  }

  renderFoot = () => {
    const {foot, value, update, modalRef, result} = this.props;
    if (foot) {
      return foot(value, modalRef);
    } else {
      return (
        <ModalFooter>
          <Button onClick={() => {
            modalRef.close();
          }}>取消</Button>
        </ModalFooter>
      );
    }
  };

  render() {
    const {json} = this.props;
    return (
      <div>
        <ReactJson src={json} name={false} displayDataTypes={false}/>
        {this.renderFoot()}
      </div>
    );
  }
}
